package com.mail.dubbo.api;

import com.mail.dubbo.mapper.OmsOrderSettingMapper;
import com.mail.model.db.OmsOrderSetting;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class OrderSettingApiImpl implements OrderSettingApi {

    @Autowired
    private OmsOrderSettingMapper orderSettingMapper;

    //修改指定订单设置
    public Integer update(OmsOrderSetting orderSetting) {
//        QueryWrapper<OmsOrderSetting> qw = new QueryWrapper<>();
//        Integer commentOvertime = orderSetting.getCommentOvertime();
//        Integer flashOrderOvertime = orderSetting.getFlashOrderOvertime();
//        Integer confirmOvertime = orderSetting.getConfirmOvertime();
//        Integer normalOrderOvertime = orderSetting.getNormalOrderOvertime();
//        Integer finishOvertime = orderSetting.getFinishOvertime();
//        qw.eq(commentOvertime != null, "comment_overtime", commentOvertime);
//        qw.eq(flashOrderOvertime != null, "flash_order_overtime", flashOrderOvertime);
//        qw.eq(confirmOvertime != null, "confirm_overtime", confirmOvertime);
//        qw.eq(normalOrderOvertime != null, "normal_order_overtime", normalOrderOvertime);
//        qw.eq(finishOvertime != null, "finish_overtime", finishOvertime);
        return orderSettingMapper.updateById(orderSetting);
    }

    //获取指定订单设置
    public OmsOrderSetting findById(Long id) {
        return orderSettingMapper.selectById(id);
    }
}
